var r, n = new Uint8Array(16);
function e() {
  if (!r && !(r = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto)))
    throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
  return r(n)
}
const t = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
function o(r) {
  return "string" == typeof r && t.test(r)
}
for (var a, u, i = [], c = 0; c < 256; ++c)
  i.push((c + 256).toString(16).substr(1));
function s(r) {
  var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0
    , e = (i[r[n + 0]] + i[r[n + 1]] + i[r[n + 2]] + i[r[n + 3]] + "-" + i[r[n + 4]] + i[r[n + 5]] + "-" + i[r[n + 6]] + i[r[n + 7]] + "-" + i[r[n + 8]] + i[r[n + 9]] + "-" + i[r[n + 10]] + i[r[n + 11]] + i[r[n + 12]] + i[r[n + 13]] + i[r[n + 14]] + i[r[n + 15]]).toLowerCase();
  if (!o(e))
    throw TypeError("Stringified UUID is invalid");
  return e
}
var f = 0
  , v = 0;
function l(r, n, t) {
  var o = n && t || 0
    , i = n || new Array(16)
    , c = (r = r || {}).node || a
    , l = void 0 !== r.clockseq ? r.clockseq : u;
  if (null == c || null == l) {
    var p = r.random || (r.rng || e)();
    null == c && (c = a = [1 | p[0], p[1], p[2], p[3], p[4], p[5]]),
    null == l && (l = u = 16383 & (p[6] << 8 | p[7]))
  }
  var d = void 0 !== r.msecs ? r.msecs : Date.now()
    , h = void 0 !== r.nsecs ? r.nsecs : v + 1
    , y = d - f + (h - v) / 1e4;
  if (y < 0 && void 0 === r.clockseq && (l = l + 1 & 16383),
  (y < 0 || d > f) && void 0 === r.nsecs && (h = 0),
  h >= 1e4)
    throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
  f = d,
    v = h,
    u = l;
  var g = (1e4 * (268435455 & (d += 122192928e5)) + h) % 4294967296;
  i[o++] = g >>> 24 & 255,
    i[o++] = g >>> 16 & 255,
    i[o++] = g >>> 8 & 255,
    i[o++] = 255 & g;
  var m = d / 4294967296 * 1e4 & 268435455;
  i[o++] = m >>> 8 & 255,
    i[o++] = 255 & m,
    i[o++] = m >>> 24 & 15 | 16,
    i[o++] = m >>> 16 & 255,
    i[o++] = l >>> 8 | 128,
    i[o++] = 255 & l;
  for (var w = 0; w < 6; ++w)
    i[o + w] = c[w];
  return n || s(i)
}
function p(r, n, e) {
  function t(r, t, a, u) {
    if ("string" == typeof r && (r = function(r) {
      r = unescape(encodeURIComponent(r));
      for (var n = [], e = 0; e < r.length; ++e)
        n.push(r.charCodeAt(e));
      return n
    }(r)),
    "string" == typeof t && (t = function(r) {
      if (!o(r))
        throw TypeError("Invalid UUID");
      var n, e = new Uint8Array(16);
      return e[0] = (n = parseInt(r.slice(0, 8), 16)) >>> 24,
        e[1] = n >>> 16 & 255,
        e[2] = n >>> 8 & 255,
        e[3] = 255 & n,
        e[4] = (n = parseInt(r.slice(9, 13), 16)) >>> 8,
        e[5] = 255 & n,
        e[6] = (n = parseInt(r.slice(14, 18), 16)) >>> 8,
        e[7] = 255 & n,
        e[8] = (n = parseInt(r.slice(19, 23), 16)) >>> 8,
        e[9] = 255 & n,
        e[10] = (n = parseInt(r.slice(24, 36), 16)) / 1099511627776 & 255,
        e[11] = n / 4294967296 & 255,
        e[12] = n >>> 24 & 255,
        e[13] = n >>> 16 & 255,
        e[14] = n >>> 8 & 255,
        e[15] = 255 & n,
        e
    }(t)),
    16 !== t.length)
      throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
    var i = new Uint8Array(16 + r.length);
    if (i.set(t),
      i.set(r, t.length),
      (i = e(i))[6] = 15 & i[6] | n,
      i[8] = 63 & i[8] | 128,
      a) {
      u = u || 0;
      for (var c = 0; c < 16; ++c)
        a[u + c] = i[c];
      return a
    }
    return s(i)
  }
  try {
    t.name = r
  } catch (a) {}
  return t.DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
    t.URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8",
    t
}
function d(r) {
  return 14 + (r + 64 >>> 9 << 4) + 1
}
function h(r, n) {
  var e = (65535 & r) + (65535 & n);
  return (r >> 16) + (n >> 16) + (e >> 16) << 16 | 65535 & e
}
function y(r, n, e, t, o, a) {
  return h((u = h(h(n, r), h(t, a))) << (i = o) | u >>> 32 - i, e);
  var u, i
}
function g(r, n, e, t, o, a, u) {
  return y(n & e | ~n & t, r, n, o, a, u)
}
function m(r, n, e, t, o, a, u) {
  return y(n & t | e & ~t, r, n, o, a, u)
}
function w(r, n, e, t, o, a, u) {
  return y(n ^ e ^ t, r, n, o, a, u)
}
function A(r, n, e, t, o, a, u) {
  return y(e ^ (n | ~t), r, n, o, a, u)
}
var b = p("v3", 48, (function(r) {
    if ("string" == typeof r) {
      var n = unescape(encodeURIComponent(r));
      r = new Uint8Array(n.length);
      for (var e = 0; e < n.length; ++e)
        r[e] = n.charCodeAt(e)
    }
    return function(r) {
      for (var n = [], e = 32 * r.length, t = "0123456789abcdef", o = 0; o < e; o += 8) {
        var a = r[o >> 5] >>> o % 32 & 255
          , u = parseInt(t.charAt(a >>> 4 & 15) + t.charAt(15 & a), 16);
        n.push(u)
      }
      return n
    }(function(r, n) {
      r[n >> 5] |= 128 << n % 32,
        r[d(n) - 1] = n;
      for (var e = 1732584193, t = -271733879, o = -1732584194, a = 271733878, u = 0; u < r.length; u += 16) {
        var i = e
          , c = t
          , s = o
          , f = a;
        e = g(e, t, o, a, r[u], 7, -680876936),
          a = g(a, e, t, o, r[u + 1], 12, -389564586),
          o = g(o, a, e, t, r[u + 2], 17, 606105819),
          t = g(t, o, a, e, r[u + 3], 22, -1044525330),
          e = g(e, t, o, a, r[u + 4], 7, -176418897),
          a = g(a, e, t, o, r[u + 5], 12, 1200080426),
          o = g(o, a, e, t, r[u + 6], 17, -1473231341),
          t = g(t, o, a, e, r[u + 7], 22, -45705983),
          e = g(e, t, o, a, r[u + 8], 7, 1770035416),
          a = g(a, e, t, o, r[u + 9], 12, -1958414417),
          o = g(o, a, e, t, r[u + 10], 17, -42063),
          t = g(t, o, a, e, r[u + 11], 22, -1990404162),
          e = g(e, t, o, a, r[u + 12], 7, 1804603682),
          a = g(a, e, t, o, r[u + 13], 12, -40341101),
          o = g(o, a, e, t, r[u + 14], 17, -1502002290),
          e = m(e, t = g(t, o, a, e, r[u + 15], 22, 1236535329), o, a, r[u + 1], 5, -165796510),
          a = m(a, e, t, o, r[u + 6], 9, -1069501632),
          o = m(o, a, e, t, r[u + 11], 14, 643717713),
          t = m(t, o, a, e, r[u], 20, -373897302),
          e = m(e, t, o, a, r[u + 5], 5, -701558691),
          a = m(a, e, t, o, r[u + 10], 9, 38016083),
          o = m(o, a, e, t, r[u + 15], 14, -660478335),
          t = m(t, o, a, e, r[u + 4], 20, -405537848),
          e = m(e, t, o, a, r[u + 9], 5, 568446438),
          a = m(a, e, t, o, r[u + 14], 9, -1019803690),
          o = m(o, a, e, t, r[u + 3], 14, -187363961),
          t = m(t, o, a, e, r[u + 8], 20, 1163531501),
          e = m(e, t, o, a, r[u + 13], 5, -1444681467),
          a = m(a, e, t, o, r[u + 2], 9, -51403784),
          o = m(o, a, e, t, r[u + 7], 14, 1735328473),
          e = w(e, t = m(t, o, a, e, r[u + 12], 20, -1926607734), o, a, r[u + 5], 4, -378558),
          a = w(a, e, t, o, r[u + 8], 11, -2022574463),
          o = w(o, a, e, t, r[u + 11], 16, 1839030562),
          t = w(t, o, a, e, r[u + 14], 23, -35309556),
          e = w(e, t, o, a, r[u + 1], 4, -1530992060),
          a = w(a, e, t, o, r[u + 4], 11, 1272893353),
          o = w(o, a, e, t, r[u + 7], 16, -155497632),
          t = w(t, o, a, e, r[u + 10], 23, -1094730640),
          e = w(e, t, o, a, r[u + 13], 4, 681279174),
          a = w(a, e, t, o, r[u], 11, -358537222),
          o = w(o, a, e, t, r[u + 3], 16, -722521979),
          t = w(t, o, a, e, r[u + 6], 23, 76029189),
          e = w(e, t, o, a, r[u + 9], 4, -640364487),
          a = w(a, e, t, o, r[u + 12], 11, -421815835),
          o = w(o, a, e, t, r[u + 15], 16, 530742520),
          e = A(e, t = w(t, o, a, e, r[u + 2], 23, -995338651), o, a, r[u], 6, -198630844),
          a = A(a, e, t, o, r[u + 7], 10, 1126891415),
          o = A(o, a, e, t, r[u + 14], 15, -1416354905),
          t = A(t, o, a, e, r[u + 5], 21, -57434055),
          e = A(e, t, o, a, r[u + 12], 6, 1700485571),
          a = A(a, e, t, o, r[u + 3], 10, -1894986606),
          o = A(o, a, e, t, r[u + 10], 15, -1051523),
          t = A(t, o, a, e, r[u + 1], 21, -2054922799),
          e = A(e, t, o, a, r[u + 8], 6, 1873313359),
          a = A(a, e, t, o, r[u + 15], 10, -30611744),
          o = A(o, a, e, t, r[u + 6], 15, -1560198380),
          t = A(t, o, a, e, r[u + 13], 21, 1309151649),
          e = A(e, t, o, a, r[u + 4], 6, -145523070),
          a = A(a, e, t, o, r[u + 11], 10, -1120210379),
          o = A(o, a, e, t, r[u + 2], 15, 718787259),
          t = A(t, o, a, e, r[u + 9], 21, -343485551),
          e = h(e, i),
          t = h(t, c),
          o = h(o, s),
          a = h(a, f)
      }
      return [e, t, o, a]
    }(function(r) {
      if (0 === r.length)
        return [];
      for (var n = 8 * r.length, e = new Uint32Array(d(n)), t = 0; t < n; t += 8)
        e[t >> 5] |= (255 & r[t / 8]) << t % 32;
      return e
    }(r), 8 * r.length))
  }
));
const U = b;
function C(r, n, t) {
  var o = (r = r || {}).random || (r.rng || e)();
  if (o[6] = 15 & o[6] | 64,
    o[8] = 63 & o[8] | 128,
    n) {
    t = t || 0;
    for (var a = 0; a < 16; ++a)
      n[t + a] = o[a];
    return n
  }
  return s(o)
}
function I(r, n, e, t) {
  switch (r) {
    case 0:
      return n & e ^ ~n & t;
    case 1:
    case 3:
      return n ^ e ^ t;
    case 2:
      return n & e ^ n & t ^ e & t
  }
}
function R(r, n) {
  return r << n | r >>> 32 - n
}
var E = p("v5", 80, (function(r) {
    var n = [1518500249, 1859775393, 2400959708, 3395469782]
      , e = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
    if ("string" == typeof r) {
      var t = unescape(encodeURIComponent(r));
      r = [];
      for (var o = 0; o < t.length; ++o)
        r.push(t.charCodeAt(o))
    } else
      Array.isArray(r) || (r = Array.prototype.slice.call(r));
    r.push(128);
    for (var a = r.length / 4 + 2, u = Math.ceil(a / 16), i = new Array(u), c = 0; c < u; ++c) {
      for (var s = new Uint32Array(16), f = 0; f < 16; ++f)
        s[f] = r[64 * c + 4 * f] << 24 | r[64 * c + 4 * f + 1] << 16 | r[64 * c + 4 * f + 2] << 8 | r[64 * c + 4 * f + 3];
      i[c] = s
    }
    i[u - 1][14] = 8 * (r.length - 1) / Math.pow(2, 32),
      i[u - 1][14] = Math.floor(i[u - 1][14]),
      i[u - 1][15] = 8 * (r.length - 1) & 4294967295;
    for (var v = 0; v < u; ++v) {
      for (var l = new Uint32Array(80), p = 0; p < 16; ++p)
        l[p] = i[v][p];
      for (var d = 16; d < 80; ++d)
        l[d] = R(l[d - 3] ^ l[d - 8] ^ l[d - 14] ^ l[d - 16], 1);
      for (var h = e[0], y = e[1], g = e[2], m = e[3], w = e[4], A = 0; A < 80; ++A) {
        var b = Math.floor(A / 20)
          , U = R(h, 5) + I(b, y, g, m) + w + n[b] + l[A] >>> 0;
        w = m,
          m = g,
          g = R(y, 30) >>> 0,
          y = h,
          h = U
      }
      e[0] = e[0] + h >>> 0,
        e[1] = e[1] + y >>> 0,
        e[2] = e[2] + g >>> 0,
        e[3] = e[3] + m >>> 0,
        e[4] = e[4] + w >>> 0
    }
    return [e[0] >> 24 & 255, e[0] >> 16 & 255, e[0] >> 8 & 255, 255 & e[0], e[1] >> 24 & 255, e[1] >> 16 & 255, e[1] >> 8 & 255, 255 & e[1], e[2] >> 24 & 255, e[2] >> 16 & 255, e[2] >> 8 & 255, 255 & e[2], e[3] >> 24 & 255, e[3] >> 16 & 255, e[3] >> 8 & 255, 255 & e[3], e[4] >> 24 & 255, e[4] >> 16 & 255, e[4] >> 8 & 255, 255 & e[4]]
  }
));
const M = E;
export {U as a, C as b, M as c, l as v};
